 /**
 *  This class publishes messages on the following topics:
 *  - tibco.admin.monitormanage.mainPage.navigation : specifies the page to display
 *
 *  This class subscribes to the following topics:
 *  - tibco.admin.monitormanage.mainPage.navigation : specifies the page to display
 */
 jsx3.lang.Class.defineInterface(
   "tibco.admin.monitormanage.framework.mainPage.MainPageInterface",                   // the full name of the class to create
    tibco.admin.plugin.PluginInterface ,                       // extends
    function(plugin) {
    
    	plugin.mainPageTabClickedSubject = "com.tibco.admin.monitormanage.framework.mainPage.MainPageInterface.mainPageTabClicked";
    
		/**
        * Abstract method to be implemented by all implementing classes.
        *  
        * This method should return the String value that will be displayed
        * on the tab for this component
        */
        plugin.prototype.getTabText = jsx3.lang.Method.newAbstract();
        
        plugin.prototype.componentWasLoaded = false;
        plugin.prototype.parentObj = null;
        plugin.prototype.defaultScreen = null;
        
        /**
        * Pre-implemented function that should NOT be overridden by the plugin component.
        *
        * This method calls loadComponent on the class to load the content of the component
        * once the tab has been selected instead of when the perspective is initialized.  
        *
        */
        plugin.prototype.loadTabContent = function(objEvent) {
        	if(!this.componentWasLoaded)
        	{
        		this.loadComponent(objEvent.target.getContentPane());
        		this.componentWasLoaded = true;
        	}

			// post a message to notify components that the main page tab was clicked        	
        	var message = { screenId:this.getDefaultScreenId() };
        	tibco.admin.monitormanage.general.PageBusUtils.publish(plugin.mainPageTabClickedSubject, message);
               	
        	
        	// post a message to notify components of the currently viewed screen
        	tibco.admin.monitormanage.general.NavigationHandler.publishMainPageNavigationMessage(this.getDefaultScreenId(), null, true);
        	
        	this.mainPageTabSelected();
        }
        
        /**
        * Pre-implemented function that should be overridden by the plugin component if
        * the page has secondary screens (screens which will be shown but not on the 
        * first selection of the tab)
        *
        * This method is invoked when the tab is selected
        */
        plugin.prototype.mainPageTabSelected = function() {
        }
        
        /**
        * Pre-implemented function that should NOT be overridden by the plugin component.
        *
        * Not for public use.  This method is called by the MainPage class and the 
        * NavigationHandler class to indicate that the plugin component has been loaded.
        */
        plugin.prototype.setComponentWasLoaded = function(compWasLoaded) {
        	this.componentWasLoaded = compWasLoaded;
        }
        
        /**
        * Pre-implemented function that should NOT be overridden by the plugin component.
        *
        * This method specifies whether the plugin component has been loaded.
        */
        plugin.prototype.isComponentLoaded = function() {
        	return this.componentWasLoaded;
        }
        
        /**
        * Pre-implemented function that should NOT be overridden by the plugin component.
        *
        * Not for public use.  This method is called by the MainPage class.
        */
        plugin.prototype.setParentObj = function(parentObj) {
        	this.parentObj = parentObj;
        }
        
        /**
        * Pre-implemented function that should NOT be overridden by the plugin component.
        *
        * Not for public use.  This method returns the parent object to which to load the UI
        * Called by the Navigation Handler when a secondary main page screen is going to be
        * displayed for the first time.
        */
        plugin.prototype.getParentObj = function() {
        	return this.parentObj;
        }
        
        /**
        * Pre-implemented function that should be overridden by the plugin component if
        * the page has secondary screens (screens which will be shown but not on the 
        * first selection of the tab) OR if the plugin component wishes to use the PollingHandler
        * functionality.
        *
        * This method should return an array of ids which uniquely identify the screen  
        */
        plugin.prototype.getScreenIds = function() {
        	return null;
        }
        
        /**
        * Pre-implemented function that should be overridden by the plugin component if
        * the page has secondary screens (screens which will be shown but not on the 
        * first selection of the tab) OR if the plugin component wishes to use the PollingHandler
        * functionality.
        *
        * This method should return the id of the screen which should be shown if the tab is clicked
        */
        plugin.prototype.getDefaultScreenId = function() {
        	return null;
        }
        
        /**
        * Pre-implemented function that should be overridden by the plugin component if
        * the page has secondary screens (screens which will be shown but not on the 
        * first selection of the tab)
        *
        * This method will be invoked when the secondary screen UI should be built.
        * The screenId will be passed in to identify which screen to build.
        * The parameterArray is an associative array which will be passed in to provide
        * any required inputs to the secondary screen. 
        */
        plugin.prototype.buildScreen = function(screenId, parameterArray) {
        }
        
        /**
        * Pre-implemented function that should be overridden by the plugin component if
        * the page has secondary screens (screens which will be shown but not on the 
        * first selection of the tab)
        *
        * This method will be invoked when the secondary screen UI should be displayed.
        * The screenId will be passed in to identify which screen to build.
        * The parameterArray is an associative array which will be passed in to provide
        * any required inputs to the secondary screen.
        */
        plugin.prototype.displayScreen = function(screenId, parameterArray) {
        }
 
    }
 );